package com.example.week13;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.TextView;

import com.example.week13.ui.MyApplication;

public class SaveInstanceActivity extends AppCompatActivity {
    private final String GAME_STATE_KEY = "gameState";
    private final String GAME_CREDITS_KEY = "gameCredits";
    private MyApplication app;
    //定义用于显示信息的文本框
    private TextView global_variable_txt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_save_instance);
        //获得 MyApplication 对象 app
        app = (MyApplication) getApplication();
        //初始化组件，从 app 取出全局变量的值，可见 MyApplication 对象 app 是对整个应用有效的变量
        global_variable_txt = findViewById(R.id.global_variable_txt);
        global_variable_txt.setText("用户姓名:"+app.getUserName()+"\n 机构名称："+app.getOrgName());
    }
}